public class tet5_2 {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100000000; i++) {
            String numStr = String.valueOf(i);
            int length = numStr.length();
            if (length % 2 == 0) {
                int halfLength = length / 2;
                int frontSum = 0;
                int backSum = 0;

                for (int j = 0; j < halfLength; j++) {
                    frontSum += Character.getNumericValue(numStr.charAt(j));
                }

                for (int k = halfLength; k < length; k++) {
                    backSum += Character.getNumericValue(numStr.charAt(k));
                }

                if (frontSum == backSum) {
                    count++;
                }
            }
        }

        System.out.println("1到100000000之间不同的幸运数字的个数为：" + count);
    }
}
